home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / binutils / arparse.c < prev    next >
C/C++ Source or Header  |  1994-10-13  |  27KB  |  1,000 lines

  1.  
  2. /*  A Bison parser, made from ./arparse.y with Bison version GNU Bison version 1.22
  3.   */
  4.  
  5. #define YYBISON 1  /* Identify Bison output.  */
  6.  
  7. #define    NEWLINE    258
  8. #define    VERBOSE    259
  9. #define    FILENAME    260
  10. #define    ADDLIB    261
  11. #define    LIST    262
  12. #define    ADDMOD    263
  13. #define    CLEAR    264
  14. #define    CREATE    265
  15. #define    DELETE    266
  16. #define    DIRECTORY    267
  17. #define    END    268
  18. #define    EXTRACT    269
  19. #define    FULLDIR    270
  20. #define    HELP    271
  21. #define    QUIT    272
  22. #define    REPLACE    273
  23. #define    SAVE    274
  24. #define    OPEN    275
  25.  
  26. #line 1 "./arparse.y"
  27.  
  28. /* arparse.y - Stange script language parser */
  29.  
  30. /*   Copyright (C) 1992 Free Software Foundation, Inc.
  31.  
  32. This file is part of GNU Binutils.
  33.  
  34. This program is free software; you can redistribute it and/or modify
  35. it under the terms of the GNU General Public License as published by
  36. the Free Software Foundation; either version 2 of the License, or
  37. (at your option) any later version.
  38.  
  39. This program is distributed in the hope that it will be useful,
  40. but WITHOUT ANY WARRANTY; without even the implied warranty of
  41. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  42. GNU General Public License for more details.
  43.  
  44. You should have received a copy of the GNU General Public License
  45. along with this program; if not, write to the Free Software
  46. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  47.  
  48.  
  49. /* Contributed by Steve Chamberlain
  50.              sac@cygnus.com
  51.  
  52. */
  53. #define DONTDECLARE_MALLOC
  54. #include "bfd.h"
  55. #include <sysdep.h>
  56. #include "arsup.h"
  57. extern int verbose;
  58.  
  59. #line 34 "./arparse.y"
  60. typedef union {
  61.   char *name;
  62. struct list *list ;
  63.  
  64. } YYSTYPE;
  65.  
  66. #ifndef YYLTYPE
  67. typedef
  68.   struct yyltype
  69.     {
  70.       int timestamp;
  71.       int first_line;
  72.       int first_column;
  73.       int last_line;
  74.       int last_column;
  75.       char *text;
  76.    }
  77.   yyltype;
  78.  
  79. #define YYLTYPE yyltype
  80. #endif
  81.  
  82. #include <stdio.h>
  83.  
  84. #ifndef __cplusplus
  85. #ifndef __STDC__
  86. #define const
  87. #endif
  88. #endif
  89.  
  90.  
  91.  
  92. #define    YYFINAL        53
  93. #define    YYFLAG        -32768
  94. #define    YYNTBASE    24
  95.  
  96. #define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 45)
  97.  
  98. static const char yytranslate[] = {     0,
  99.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  100.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  101.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  102.      2,     2,     2,     2,     2,     2,     2,     2,     2,    21,
  103.     22,     2,     2,    23,     2,     2,     2,     2,     2,     2,
  104.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  105.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  106.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  107.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  108.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  109.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  110.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  111.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  112.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  113.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  114.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  115.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  116.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  117.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  118.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  119.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  120.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  121.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  122.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  123.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  124.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  125.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  126.     16,    17,    18,    19,    20
  127. };
  128.  
  129. #if YYDEBUG != 0
  130. static const short yyprhs[] = {     0,
  131.      0,     1,     4,     7,     8,    11,    13,    15,    17,    19,
  132.     21,    23,    25,    27,    29,    31,    33,    35,    37,    39,
  133.     41,    42,    45,    48,    50,    53,    56,    58,    60,    63,
  134.     66,    70,    75,    77,    78,    82,    83,    87,    88,    90,
  135.     91
  136. };
  137.  
  138. static const short yyrhs[] = {    -1,
  139.     25,    26,     0,    26,    27,     0,     0,    28,     3,     0,
  140.     36,     0,    37,     0,    44,     0,    39,     0,    38,     0,
  141.     31,     0,    33,     0,    35,     0,    29,     0,    30,     0,
  142.     32,     0,    34,     0,    13,     0,     1,     0,     5,     0,
  143.      0,    14,    42,     0,    18,    42,     0,     9,     0,    11,
  144.     42,     0,     8,    42,     0,     7,     0,    19,     0,    20,
  145.      5,     0,    10,     5,     0,     6,     5,    41,     0,    12,
  146.      5,    41,    40,     0,     5,     0,     0,    21,    42,    22,
  147.      0,     0,    42,    43,     5,     0,     0,    23,     0,     0,
  148.      4,     0
  149. };
  150.  
  151. #endif
  152.  
  153. #if YYDEBUG != 0
  154. static const short yyrline[] = { 0,
  155.     64,    66,    68,    70,    73,    76,    78,    79,    80,    81,
  156.     82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
  157.     92,    96,   101,   106,   111,   115,   120,   125,   132,   137,
  158.    143,   147,   154,   157,   160,   163,   167,   174,   178,   180,
  159.    184
  160. };
  161.  
  162. static const char * const yytname[] = {   "$","error","$illegal.","NEWLINE",
  163. "VERBOSE","FILENAME","ADDLIB","LIST","ADDMOD","CLEAR","CREATE","DELETE","DIRECTORY",
  164. "END","EXTRACT","FULLDIR","HELP","QUIT","REPLACE","SAVE","OPEN","'('","')'",
  165. "','","start","@1","session","command_line","command","extract_command","replace_command",
  166. "clear_command","delete_command","addmod_command","list_command","save_command",
  167. "open_command","create_command","addlib_command","directory_command","optional_filename",
  168. "modulelist","modulename","optcomma","verbose_command",""
  169. };
  170. #endif
  171.  
  172. static const short yyr1[] = {     0,
  173.     25,    24,    26,    26,    27,    28,    28,    28,    28,    28,
  174.     28,    28,    28,    28,    28,    28,    28,    28,    28,    28,
  175.     28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
  176.     38,    39,    40,    40,    41,    41,    42,    42,    43,    43,
  177.     44
  178. };
  179.  
  180. static const short yyr2[] = {     0,
  181.      0,     2,     2,     0,     2,     1,     1,     1,     1,     1,
  182.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  183.      0,     2,     2,     1,     2,     2,     1,     1,     2,     2,
  184.      3,     4,     1,     0,     3,     0,     3,     0,     1,     0,
  185.      1
  186. };
  187.  
  188. static const short yydefact[] = {     1,
  189.      4,     0,    19,    41,    20,     0,    27,    38,    24,     0,
  190.     38,     0,    18,    38,    38,    28,     0,     3,     0,    14,
  191.     15,    11,    16,    12,    17,    13,     6,     7,    10,     9,
  192.      8,    36,    26,    30,    25,    36,    22,    23,    29,     5,
  193.     38,    31,    39,     0,    34,    40,    37,    33,    32,    35,
  194.      0,     0,     0
  195. };
  196.  
  197. static const short yydefgoto[] = {    51,
  198.      1,     2,    18,    19,    20,    21,    22,    23,    24,    25,
  199.     26,    27,    28,    29,    30,    49,    42,    33,    44,    31
  200. };
  201.  
  202. static const short yypact[] = {-32768,
  203. -32768,     5,-32768,-32768,-32768,    -4,-32768,-32768,-32768,     2,
  204. -32768,    21,-32768,-32768,-32768,-32768,    22,-32768,    25,-32768,
  205. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  206. -32768,     8,    -3,-32768,    -3,     8,    -3,    -3,-32768,-32768,
  207. -32768,-32768,-32768,    26,    27,    -1,-32768,-32768,-32768,-32768,
  208.     33,    34,-32768
  209. };
  210.  
  211. static const short yypgoto[] = {-32768,
  212. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  213. -32768,-32768,-32768,-32768,-32768,-32768,     0,   -11,-32768,-32768
  214. };
  215.  
  216.  
  217. #define    YYLAST        36
  218.  
  219.  
  220. static const short yytable[] = {    35,
  221.     32,   -40,    37,    38,    -2,     3,    34,   -21,     4,     5,
  222.      6,     7,     8,     9,    10,    11,    12,    13,    14,    43,
  223.     50,    43,    15,    16,    17,    36,    39,    40,    41,    46,
  224.     47,    48,    52,    53,     0,    45
  225. };
  226.  
  227. static const short yycheck[] = {    11,
  228.      5,     5,    14,    15,     0,     1,     5,     3,     4,     5,
  229.      6,     7,     8,     9,    10,    11,    12,    13,    14,    23,
  230.     22,    23,    18,    19,    20,     5,     5,     3,    21,    41,
  231.      5,     5,     0,     0,    -1,    36
  232. };
  233. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  234. #line 3 "/usr/unsupported/lib/bison.simple"
  235.  
  236. /* Skeleton output parser for bison,
  237.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  238.  
  239.    This program is free software; you can redistribute it and/or modify
  240.    it under the terms of the GNU General Public License as published by
  241.    the Free Software Foundation; either version 1, or (at your option)
  242.    any later version.
  243.  
  244.    This program is distributed in the hope that it will be useful,
  245.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  246.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  247.    GNU General Public License for more details.
  248.  
  249.    You should have received a copy of the GNU General Public License
  250.    along with this program; if not, write to the Free Software
  251.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  252.  
  253.  
  254. #ifndef alloca
  255. #ifdef __GNUC__
  256. #define alloca __builtin_alloca
  257. #else /* not GNU C.  */
  258. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  259. #include <alloca.h>
  260. #else /* not sparc */
  261. #if defined (MSDOS) && !defined (__TURBOC__)
  262. #include <malloc.h>
  263. #else /* not MSDOS, or __TURBOC__ */
  264. #if defined(_AIX)
  265. #include <malloc.h>
  266.  #pragma alloca
  267. #else /* not MSDOS, __TURBOC__, or _AIX */
  268. #ifdef __hpux
  269. #ifdef __cplusplus
  270. extern "C" {
  271. void *alloca (unsigned int);
  272. };
  273. #else /* not __cplusplus */
  274. void *alloca ();
  275. #endif /* not __cplusplus */
  276. #endif /* __hpux */
  277. #endif /* not _AIX */
  278. #endif /* not MSDOS, or __TURBOC__ */
  279. #endif /* not sparc.  */
  280. #endif /* not GNU C.  */
  281. #endif /* alloca not defined.  */
  282.  
  283. /* This is the parser code that is written into each bison parser
  284.   when the %semantic_parser declaration is not specified in the grammar.
  285.   It was written by Richard Stallman by simplifying the hairy parser
  286.   used when %semantic_parser is specified.  */
  287.  
  288. /* Note: there must be only one dollar sign in this file.
  289.    It is replaced by the list of actions, each action
  290.    as one case of the switch.  */
  291.  
  292. #define yyerrok        (yyerrstatus = 0)
  293. #define yyclearin    (yychar = YYEMPTY)
  294. #define YYEMPTY        -2
  295. #define YYEOF        0
  296. #define YYACCEPT    return(0)
  297. #define YYABORT     return(1)
  298. #define YYERROR        goto yyerrlab1
  299. /* Like YYERROR except do call yyerror.
  300.    This remains here temporarily to ease the
  301.    transition to the new meaning of YYERROR, for GCC.
  302.    Once GCC version 2 has supplanted version 1, this can go.  */
  303. #define YYFAIL        goto yyerrlab
  304. #define YYRECOVERING()  (!!yyerrstatus)
  305. #define YYBACKUP(token, value) \
  306. do                                \
  307.   if (yychar == YYEMPTY && yylen == 1)                \
  308.     { yychar = (token), yylval = (value);            \
  309.       yychar1 = YYTRANSLATE (yychar);                \
  310.       YYPOPSTACK;                        \
  311.       goto yybackup;                        \
  312.     }                                \
  313.   else                                \
  314.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  315. while (0)
  316.  
  317. #define YYTERROR    1
  318. #define YYERRCODE    256
  319.  
  320. #ifndef YYPURE
  321. #define YYLEX        yylex()
  322. #endif
  323.  
  324. #ifdef YYPURE
  325. #ifdef YYLSP_NEEDED
  326. #define YYLEX        yylex(&yylval, &yylloc)
  327. #else
  328. #define YYLEX        yylex(&yylval)
  329. #endif
  330. #endif
  331.  
  332. /* If nonreentrant, generate the variables here */
  333.  
  334. #ifndef YYPURE
  335.  
  336. int    yychar;            /*  the lookahead symbol        */
  337. YYSTYPE    yylval;            /*  the semantic value of the        */
  338.                 /*  lookahead symbol            */
  339.  
  340. #ifdef YYLSP_NEEDED
  341. YYLTYPE yylloc;            /*  location data for the lookahead    */
  342.                 /*  symbol                */
  343. #endif
  344.  
  345. int yynerrs;            /*  number of parse errors so far       */
  346. #endif  /* not YYPURE */
  347.  
  348. #if YYDEBUG != 0
  349. int yydebug;            /*  nonzero means print parse trace    */
  350. /* Since this is uninitialized, it does not stop multiple parsers
  351.    from coexisting.  */
  352. #endif
  353.  
  354. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  355.  
  356. #ifndef    YYINITDEPTH
  357. #define YYINITDEPTH 200
  358. #endif
  359.  
  360. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  361.     (effective only if the built-in stack extension method is used).  */
  362.  
  363. #if YYMAXDEPTH == 0
  364. #undef YYMAXDEPTH
  365. #endif
  366.  
  367. #ifndef YYMAXDEPTH
  368. #define YYMAXDEPTH 10000
  369. #endif
  370.  
  371. /* Prevent warning if -Wstrict-prototypes.  */
  372. #ifdef __GNUC__
  373. int yyparse (void);
  374. #endif
  375.  
  376. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  377. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  378. #else                /* not GNU C or C++ */
  379. #ifndef __cplusplus
  380.  
  381. /* This is the most reliable way to avoid incompatibilities
  382.    in available built-in functions on various systems.  */
  383. static void
  384. __yy_bcopy (from, to, count)
  385.      char *from;
  386.      char *to;
  387.      int count;
  388. {
  389.   register char *f = from;
  390.   register char *t = to;
  391.   register int i = count;
  392.  
  393.   while (i-- > 0)
  394.     *t++ = *f++;
  395. }
  396.  
  397. #else /* __cplusplus */
  398.  
  399. /* This is the most reliable way to avoid incompatibilities
  400.    in available built-in functions on various systems.  */
  401. static void
  402. __yy_bcopy (char *from, char *to, int count)
  403. {
  404.   register char *f = from;
  405.   register char *t = to;
  406.   register int i = count;
  407.  
  408.   while (i-- > 0)
  409.     *t++ = *f++;
  410. }
  411.  
  412. #endif
  413. #endif
  414.  
  415. #line 184 "/usr/unsupported/lib/bison.simple"
  416. int
  417. yyparse()
  418. {
  419.   register int yystate;
  420.   register int yyn;
  421.   register short *yyssp;
  422.   register YYSTYPE *yyvsp;
  423.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  424.   int yychar1 = 0;        /*  lookahead token as an internal (translated) token number */
  425.  
  426.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  427.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  428.  
  429.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  430.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  431.  
  432. #ifdef YYLSP_NEEDED
  433.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  434.   YYLTYPE *yyls = yylsa;
  435.   YYLTYPE *yylsp;
  436.  
  437. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  438. #else
  439. #define YYPOPSTACK   (yyvsp--, yyssp--)
  440. #endif
  441.  
  442.   int yystacksize = YYINITDEPTH;
  443.  
  444. #ifdef YYPURE
  445.   int yychar;
  446.   YYSTYPE yylval;
  447.   int yynerrs;
  448. #ifdef YYLSP_NEEDED
  449.   YYLTYPE yylloc;
  450. #endif
  451. #endif
  452.  
  453.   YYSTYPE yyval;        /*  the variable used to return        */
  454.                 /*  semantic values from the action    */
  455.                 /*  routines                */
  456.  
  457.   int yylen;
  458.  
  459. #if YYDEBUG != 0
  460.   if (yydebug)
  461.     fprintf(stderr, "Starting parse\n");
  462. #endif
  463.  
  464.   yystate = 0;
  465.   yyerrstatus = 0;
  466.   yynerrs = 0;
  467.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  468.  
  469.   /* Initialize stack pointers.
  470.      Waste one element of value and location stack
  471.      so that they stay on the same level as the state stack.
  472.      The wasted elements are never initialized.  */
  473.  
  474.   yyssp = yyss - 1;
  475.   yyvsp = yyvs;
  476. #ifdef YYLSP_NEEDED
  477.   yylsp = yyls;
  478. #endif
  479.  
  480. /* Push a new state, which is found in  yystate  .  */
  481. /* In all cases, when you get here, the value and location stacks
  482.    have just been pushed. so pushing a state here evens the stacks.  */
  483. yynewstate:
  484.  
  485.   *++yyssp = yystate;
  486.  
  487.   if (yyssp >= yyss + yystacksize - 1)
  488.     {
  489.       /* Give user a chance to reallocate the stack */
  490.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  491.       YYSTYPE *yyvs1 = yyvs;
  492.       short *yyss1 = yyss;
  493. #ifdef YYLSP_NEEDED
  494.       YYLTYPE *yyls1 = yyls;
  495. #endif
  496.  
  497.       /* Get the current used size of the three stacks, in elements.  */
  498.       int size = yyssp - yyss + 1;
  499.  
  500. #ifdef yyoverflow
  501.       /* Each stack pointer address is followed by the size of
  502.      the data in use in that stack, in bytes.  */
  503. #ifdef YYLSP_NEEDED
  504.       /* This used to be a conditional around just the two extra args,
  505.      but that might be undefined if yyoverflow is a macro.  */
  506.       yyoverflow("parser stack overflow",
  507.          &yyss1, size * sizeof (*yyssp),
  508.          &yyvs1, size * sizeof (*yyvsp),
  509.          &yyls1, size * sizeof (*yylsp),
  510.          &yystacksize);
  511. #else
  512.       yyoverflow("parser stack overflow",
  513.          &yyss1, size * sizeof (*yyssp),
  514.          &yyvs1, size * sizeof (*yyvsp),
  515.          &yystacksize);
  516. #endif
  517.  
  518.       yyss = yyss1; yyvs = yyvs1;
  519. #ifdef YYLSP_NEEDED
  520.       yyls = yyls1;
  521. #endif
  522. #else /* no yyoverflow */
  523.       /* Extend the stack our own way.  */
  524.       if (yystacksize >= YYMAXDEPTH)
  525.     {
  526.       yyerror("parser stack overflow");
  527.       return 2;
  528.     }
  529.       yystacksize *= 2;
  530.       if (yystacksize > YYMAXDEPTH)
  531.     yystacksize = YYMAXDEPTH;
  532.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  533.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  534.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  535.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  536. #ifdef YYLSP_NEEDED
  537.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  538.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  539. #endif
  540. #endif /* no yyoverflow */
  541.  
  542.       yyssp = yyss + size - 1;
  543.       yyvsp = yyvs + size - 1;
  544. #ifdef YYLSP_NEEDED
  545.       yylsp = yyls + size - 1;
  546. #endif
  547.  
  548. #if YYDEBUG != 0
  549.       if (yydebug)
  550.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  551. #endif
  552.  
  553.       if (yyssp >= yyss + yystacksize - 1)
  554.     YYABORT;
  555.     }
  556.  
  557. #if YYDEBUG != 0
  558.   if (yydebug)
  559.     fprintf(stderr, "Entering state %d\n", yystate);
  560. #endif
  561.  
  562.   goto yybackup;
  563.  yybackup:
  564.  
  565. /* Do appropriate processing given the current state.  */
  566. /* Read a lookahead token if we need one and don't already have one.  */
  567. /* yyresume: */
  568.  
  569.   /* First try to decide what to do without reference to lookahead token.  */
  570.  
  571.   yyn = yypact[yystate];
  572.   if (yyn == YYFLAG)
  573.     goto yydefault;
  574.  
  575.   /* Not known => get a lookahead token if don't already have one.  */
  576.  
  577.   /* yychar is either YYEMPTY or YYEOF
  578.      or a valid token in external form.  */
  579.  
  580.   if (yychar == YYEMPTY)
  581.     {
  582. #if YYDEBUG != 0
  583.       if (yydebug)
  584.     fprintf(stderr, "Reading a token: ");
  585. #endif
  586.       yychar = YYLEX;
  587.     }
  588.  
  589.   /* Convert token to internal form (in yychar1) for indexing tables with */
  590.  
  591.   if (yychar <= 0)        /* This means end of input. */
  592.     {
  593.       yychar1 = 0;
  594.       yychar = YYEOF;        /* Don't call YYLEX any more */
  595.  
  596. #if YYDEBUG != 0
  597.       if (yydebug)
  598.     fprintf(stderr, "Now at end of input.\n");
  599. #endif
  600.     }
  601.   else
  602.     {
  603.       yychar1 = YYTRANSLATE(yychar);
  604.  
  605. #if YYDEBUG != 0
  606.       if (yydebug)
  607.     {
  608.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  609.       /* Give the individual parser a way to print the precise meaning
  610.          of a token, for further debugging info.  */
  611. #ifdef YYPRINT
  612.       YYPRINT (stderr, yychar, yylval);
  613. #endif
  614.       fprintf (stderr, ")\n");
  615.     }
  616. #endif
  617.     }
  618.  
  619.   yyn += yychar1;
  620.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  621.     goto yydefault;
  622.  
  623.   yyn = yytable[yyn];
  624.  
  625.   /* yyn is what to do for this token type in this state.
  626.      Negative => reduce, -yyn is rule number.
  627.      Positive => shift, yyn is new state.
  628.        New state is final state => don't bother to shift,
  629.        just return success.
  630.      0, or most negative number => error.  */
  631.  
  632.   if (yyn < 0)
  633.     {
  634.       if (yyn == YYFLAG)
  635.     goto yyerrlab;
  636.       yyn = -yyn;
  637.       goto yyreduce;
  638.     }
  639.   else if (yyn == 0)
  640.     goto yyerrlab;
  641.  
  642.   if (yyn == YYFINAL)
  643.     YYACCEPT;
  644.  
  645.   /* Shift the lookahead token.  */
  646.  
  647. #if YYDEBUG != 0
  648.   if (yydebug)
  649.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  650. #endif
  651.  
  652.   /* Discard the token being shifted unless it is eof.  */
  653.   if (yychar != YYEOF)
  654.     yychar = YYEMPTY;
  655.  
  656.   *++yyvsp = yylval;
  657. #ifdef YYLSP_NEEDED
  658.   *++yylsp = yylloc;
  659. #endif
  660.  
  661.   /* count tokens shifted since error; after three, turn off error status.  */
  662.   if (yyerrstatus) yyerrstatus--;
  663.  
  664.   yystate = yyn;
  665.   goto yynewstate;
  666.  
  667. /* Do the default action for the current state.  */
  668. yydefault:
  669.  
  670.   yyn = yydefact[yystate];
  671.   if (yyn == 0)
  672.     goto yyerrlab;
  673.  
  674. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  675. yyreduce:
  676.   yylen = yyr2[yyn];
  677.   if (yylen > 0)
  678.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  679.  
  680. #if YYDEBUG != 0
  681.   if (yydebug)
  682.     {
  683.       int i;
  684.  
  685.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  686.            yyn, yyrline[yyn]);
  687.  
  688.       /* Print the symbols being reduced, and their result.  */
  689.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  690.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  691.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  692.     }
  693. #endif
  694.  
  695.  
  696.   switch (yyn) {
  697.  
  698. case 1:
  699. #line 65 "./arparse.y"
  700. { prompt(); ;
  701.     break;}
  702. case 5:
  703. #line 74 "./arparse.y"
  704. { prompt(); ;
  705.     break;}
  706. case 18:
  707. #line 89 "./arparse.y"
  708. { ar_end(); return 0; ;
  709.     break;}
  710. case 20:
  711. #line 91 "./arparse.y"
  712. { yyerror("foo"); ;
  713.     break;}
  714. case 22:
  715. #line 98 "./arparse.y"
  716. { ar_extract(yyvsp[0].list); ;
  717.     break;}
  718. case 23:
  719. #line 103 "./arparse.y"
  720. { ar_replace(yyvsp[0].list); ;
  721.     break;}
  722. case 24:
  723. #line 108 "./arparse.y"
  724. { ar_clear(); ;
  725.     break;}
  726. case 25:
  727. #line 113 "./arparse.y"
  728. { ar_delete(yyvsp[0].list); ;
  729.     break;}
  730. case 26:
  731. #line 117 "./arparse.y"
  732. { ar_addmod(yyvsp[0].list); ;
  733.     break;}
  734. case 27:
  735. #line 122 "./arparse.y"
  736. { ar_list(); ;
  737.     break;}
  738. case 28:
  739. #line 127 "./arparse.y"
  740. { ar_save(); ;
  741.     break;}
  742. case 29:
  743. #line 134 "./arparse.y"
  744. { ar_open(yyvsp[0].name,0); ;
  745.     break;}
  746. case 30:
  747. #line 139 "./arparse.y"
  748. { ar_open(yyvsp[0].name,1); ;
  749.     break;}
  750. case 31:
  751. #line 145 "./arparse.y"
  752. { ar_addlib(yyvsp[-1].name,yyvsp[0].list); ;
  753.     break;}
  754. case 32:
  755. #line 149 "./arparse.y"
  756. { ar_directory(yyvsp[-2].name, yyvsp[-1].list, yyvsp[0].name); ;
  757.     break;}
  758. case 33:
  759. #line 156 "./arparse.y"
  760. { yyval.name = yyvsp[0].name; ;
  761.     break;}
  762. case 34:
  763. #line 157 "./arparse.y"
  764. { yyval.name = 0; ;
  765.     break;}
  766. case 35:
  767. #line 162 "./arparse.y"
  768. { yyval.list = yyvsp[-1].list; ;
  769.     break;}
  770. case 36:
  771. #line 164 "./arparse.y"
  772. { yyval.list = 0; ;
  773.     break;}
  774. case 37:
  775. #line 169 "./arparse.y"
  776. {     struct list *n  = (struct list *) malloc(sizeof(struct list));
  777.             n->next = yyvsp[-2].list; 
  778.             n->name = yyvsp[0].name;
  779.             yyval.list = n;
  780.          ;
  781.     break;}
  782. case 38:
  783. #line 174 "./arparse.y"
  784. { yyval.list = 0; ;
  785.     break;}
  786. case 41:
  787. #line 186 "./arparse.y"
  788. { verbose = !verbose; ;
  789.     break;}
  790. }
  791.    /* the action file gets copied in in place of this dollarsign */
  792. #line 465 "/usr/unsupported/lib/bison.simple"
  793.  
  794.   yyvsp -= yylen;
  795.   yyssp -= yylen;
  796. #ifdef YYLSP_NEEDED
  797.   yylsp -= yylen;
  798. #endif
  799.  
  800. #if YYDEBUG != 0
  801.   if (yydebug)
  802.     {
  803.       short *ssp1 = yyss - 1;
  804.       fprintf (stderr, "state stack now");
  805.       while (ssp1 != yyssp)
  806.     fprintf (stderr, " %d", *++ssp1);
  807.       fprintf (stderr, "\n");
  808.     }
  809. #endif
  810.  
  811.   *++yyvsp = yyval;
  812.  
  813. #ifdef YYLSP_NEEDED
  814.   yylsp++;
  815.   if (yylen == 0)
  816.     {
  817.       yylsp->first_line = yylloc.first_line;
  818.       yylsp->first_column = yylloc.first_column;
  819.       yylsp->last_line = (yylsp-1)->last_line;
  820.       yylsp->last_column = (yylsp-1)->last_column;
  821.       yylsp->text = 0;
  822.     }
  823.   else
  824.     {
  825.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  826.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  827.     }
  828. #endif
  829.  
  830.   /* Now "shift" the result of the reduction.
  831.      Determine what state that goes to,
  832.      based on the state we popped back to
  833.      and the rule number reduced by.  */
  834.  
  835.   yyn = yyr1[yyn];
  836.  
  837.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  838.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  839.     yystate = yytable[yystate];
  840.   else
  841.     yystate = yydefgoto[yyn - YYNTBASE];
  842.  
  843.   goto yynewstate;
  844.  
  845. yyerrlab:   /* here on detecting error */
  846.  
  847.   if (! yyerrstatus)
  848.     /* If not already recovering from an error, report this error.  */
  849.     {
  850.       ++yynerrs;
  851.  
  852. #ifdef YYERROR_VERBOSE
  853.       yyn = yypact[yystate];
  854.  
  855.       if (yyn > YYFLAG && yyn < YYLAST)
  856.     {
  857.       int size = 0;
  858.       char *msg;
  859.       int x, count;
  860.  
  861.       count = 0;
  862.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  863.       for (x = (yyn < 0 ? -yyn : 0);
  864.            x < (sizeof(yytname) / sizeof(char *)); x++)
  865.         if (yycheck[x + yyn] == x)
  866.           size += strlen(yytname[x]) + 15, count++;
  867.       msg = (char *) malloc(size + 15);
  868.       if (msg != 0)
  869.         {
  870.           strcpy(msg, "parse error");
  871.  
  872.           if (count < 5)
  873.         {
  874.           count = 0;
  875.           for (x = (yyn < 0 ? -yyn : 0);
  876.                x < (sizeof(yytname) / sizeof(char *)); x++)
  877.             if (yycheck[x + yyn] == x)
  878.               {
  879.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  880.             strcat(msg, yytname[x]);
  881.             strcat(msg, "'");
  882.             count++;
  883.               }
  884.         }
  885.           yyerror(msg);
  886.           free(msg);
  887.         }
  888.       else
  889.         yyerror ("parse error; also virtual memory exceeded");
  890.     }
  891.       else
  892. #endif /* YYERROR_VERBOSE */
  893.     yyerror("parse error");
  894.     }
  895.  
  896.   goto yyerrlab1;
  897. yyerrlab1:   /* here on error raised explicitly by an action */
  898.  
  899.   if (yyerrstatus == 3)
  900.     {
  901.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  902.  
  903.       /* return failure if at end of input */
  904.       if (yychar == YYEOF)
  905.     YYABORT;
  906.  
  907. #if YYDEBUG != 0
  908.       if (yydebug)
  909.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  910. #endif
  911.  
  912.       yychar = YYEMPTY;
  913.     }
  914.  
  915.   /* Else will try to reuse lookahead token
  916.      after shifting the error token.  */
  917.  
  918.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  919.  
  920.   goto yyerrhandle;
  921.  
  922. yyerrdefault:  /* current state does not do anything special for the error token. */
  923.  
  924. #if 0
  925.   /* This is wrong; only states that explicitly want error tokens
  926.      should shift them.  */
  927.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  928.   if (yyn) goto yydefault;
  929. #endif
  930.  
  931. yyerrpop:   /* pop the current state because it cannot handle the error token */
  932.  
  933.   if (yyssp == yyss) YYABORT;
  934.   yyvsp--;
  935.   yystate = *--yyssp;
  936. #ifdef YYLSP_NEEDED
  937.   yylsp--;
  938. #endif
  939.  
  940. #if YYDEBUG != 0
  941.   if (yydebug)
  942.     {
  943.       short *ssp1 = yyss - 1;
  944.       fprintf (stderr, "Error: state stack now");
  945.       while (ssp1 != yyssp)
  946.     fprintf (stderr, " %d", *++ssp1);
  947.       fprintf (stderr, "\n");
  948.     }
  949. #endif
  950.  
  951. yyerrhandle:
  952.  
  953.   yyn = yypact[yystate];
  954.   if (yyn == YYFLAG)
  955.     goto yyerrdefault;
  956.  
  957.   yyn += YYTERROR;
  958.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  959.     goto yyerrdefault;
  960.  
  961.   yyn = yytable[yyn];
  962.   if (yyn < 0)
  963.     {
  964.       if (yyn == YYFLAG)
  965.     goto yyerrpop;
  966.       yyn = -yyn;
  967.       goto yyreduce;
  968.     }
  969.   else if (yyn == 0)
  970.     goto yyerrpop;
  971.  
  972.   if (yyn == YYFINAL)
  973.     YYACCEPT;
  974.  
  975. #if YYDEBUG != 0
  976.   if (yydebug)
  977.     fprintf(stderr, "Shifting error token, ");
  978. #endif
  979.  
  980.   *++yyvsp = yylval;
  981. #ifdef YYLSP_NEEDED
  982.   *++yylsp = yylloc;
  983. #endif
  984.  
  985.   yystate = yyn;
  986.   goto yynewstate;
  987. }
  988. #line 190 "./arparse.y"
  989.  
  990.  
  991.  
  992. int
  993. yyerror(x)
  994. char *x;
  995. {
  996.   extern int linenumber;
  997.   printf("Synax error in archive script, line %d\n", linenumber + 1);
  998.   return 0;
  999. }
  1000.